package BanqueGestion;

/**
 * Interface definition: Banque.
 * 
 * @author OpenORB Compiler
 */
public abstract class BanquePOA extends org.omg.PortableServer.Servant
        implements BanqueOperations, org.omg.CORBA.portable.InvokeHandler
{
    public Banque _this()
    {
        return BanqueHelper.narrow(_this_object());
    }

    public Banque _this(org.omg.CORBA.ORB orb)
    {
        return BanqueHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:BanqueGestion/Banque:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("creerCompte")) {
                return _invoke_creerCompte(_is, handler);
        } else if (opName.equals("listCompte")) {
                return _invoke_listCompte(_is, handler);
        } else if (opName.equals("rechercheCompte")) {
                return _invoke_rechercheCompte(_is, handler);
        } else if (opName.equals("supprimerCompte")) {
                return _invoke_supprimerCompte(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke_creerCompte(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();
        int arg1_in = _is.read_long();

        boolean _arg_result = creerCompte(arg0_in, arg1_in);

        _output = handler.createReply();
        _output.write_boolean(_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_supprimerCompte(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();

        try
        {
            supprimerCompte(arg0_in);

            _output = handler.createReply();

        }
        catch (BanqueGestion.BanquePackage.UnknownAccount _exception)
        {
            _output = handler.createExceptionReply();
            BanqueGestion.BanquePackage.UnknownAccountHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_rechercheCompte(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();

        BanqueGestion.CompteBancaire _arg_result = rechercheCompte(arg0_in);

        _output = handler.createReply();
        BanqueGestion.CompteBancaireHelper.write(_output,_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_listCompte(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();

        try
        {
            BanqueGestion.CompteBancaire[] _arg_result = listCompte(arg0_in);

            _output = handler.createReply();
            BanqueGestion.listeComptesHelper.write(_output,_arg_result);

        }
        catch (BanqueGestion.BanquePackage.InvalidAccountName _exception)
        {
            _output = handler.createExceptionReply();
            BanqueGestion.BanquePackage.InvalidAccountNameHelper.write(_output,_exception);
        }
        return _output;
    }

}
